#include<bits/stdc++.h>
#define MAX 200005
using namespace std;
int T,n,a[MAX],ans[MAX];
bool fl=0;
int vis[MAX],cnt1,cnt2;
void solve(int now){
	if(now==2*n+1){
		fl=1;
		return;
	}
	if(vis[a[cnt1+1]]){
		if(cnt1+cnt2+1+vis[a[cnt1+1]]==2*n+1){
			cnt1++;
			solve(now+1);
			if(fl){
				ans[now]=1;
				return;
			}
			cnt1--;
		}
	}else{
		vis[a[cnt1+1]]=now;
		cnt1++;
		solve(now+1);
		if(fl){
			ans[now]=1;
			return;
		}
		cnt1--;
		vis[a[cnt1+1]]=0;
	}
	if(vis[a[2*n-cnt2]]){
		if(cnt1+cnt2+1+vis[a[2*n-cnt2]]==2*n+1){
			cnt2++;
			solve(now+1);
			if(fl){
				ans[now]=0;
				return;
			}
			cnt2--;
		}
	}else{
		vis[a[2*n-cnt2]]=now;
		cnt2++;
		solve(now+1);
		if(fl){
			ans[now]=0;
			return;
		}
		cnt2--;
		vis[a[2*n-cnt2]]=0;
	}
}
int main(){
	freopen("palin.in","r",stdin);
	freopen("palin.out","w",stdout);
	scanf("%d",&T);
	while(T--){
		scanf("%d",&n);
		for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
		fl=0;
		solve(1);
		if(fl==0) printf("-1");
		else for(int i=1;i<=2*n;i++){
			if(ans[i]==1) printf("L");
			else printf("R");
		}
		printf("\n");
	}
} 
